'use strict';

/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */

describe('Character chooser', function() {
	
	beforeEach(function() {
		browser().navigateTo('index.html#/choose/path');
	});
	
	it('should properly load path choices', function() {
		expect(repeater('li.portrait-holder').count()).toBe(2);
	});
	
	it('should properly load light faction choices', function() {
		element(':button:contains(Light)').click();
		expect(repeater('li.portrait-holder').count()).toBe(4);
	});
	
	it('should properly go to character page', function() {
		element(':button:contains(Light)').click();
		element(':button:contains(Lord of the Rings)').click();
		element(':button:contains(Hobbit)').click();
		
		expect(repeater('div.character-page-holder').count()).toBe(1);
	});
	
});

describe('Character chooser', function() {
	
	beforeEach(function() {
		browser().navigateTo('index.html#/characters/lotr-hobbit');
	});
	
	it ('should properly load all elements', function(){
		
		expect(repeater('#attribute-list li').count()).toBe(6);
		expect(repeater('#save-bonus-list li').count()).toBe(3);
		expect(repeater('#skill-list li').count()).toBe(22);
	});
	
});

//it('should add contacts', function() {
//expect(repeater('div.contact').count()).toBe(1);
//element('#add-contact').click();
//expect(repeater('div.contact').count()).toBe(2);
//});
//
//it('should enable save button', function() {
//expect(element(':button:contains(Save)').attr('disabled')).toBeTruthy();
//input('form.name').enter('');
//expect(element(':button:contains(Save)').attr('disabled')).toBeTruthy();
//input('form.name').enter('change');
//expect(element(':button:contains(Save)').attr('disabled')).toBeFalsy();
//element(':button:contains(Save)').click();
//expect(element(':button:contains(Save)').attr('disabled')).toBeTruthy();
//});
//it('should enable cancel button', function() {
//expect(element(':button:contains(Cancel)').attr('disabled')).toBeTruthy();
//input('form.name').enter('change');
//expect(element(':button:contains(Cancel)').attr('disabled')).toBeFalsy();
//element(':button:contains(Cancel)').click();
//expect(element(':button:contains(Cancel)').attr('disabled')).toBeTruthy();
//expect(element(':input[ng\\:model="form.name"]').val()).toEqual('John Smith');
//});
//});